using System;

namespace CubeTimer
{
  class TimeHelper
  {
    public static string GetTimeMilliseconds(TimeSpan ts)
    {
      if (ts.Seconds == 0) return string.Empty;
      if (ts == TimeSpan.MaxValue) return "DNF";
      if (ts.Minutes == 0)
      {
        return string.Format("{0:D2}.{1:D3}", ts.Seconds, ts.Milliseconds);
      }
      return string.Format("{0:D2}:{1:D2}.{2:D3}", ts.Minutes, ts.Seconds, ts.Milliseconds);
    }
  }
}